#元组推导式
def p(p):
	print(p)

t1 = ['sad','阿斯达','阿萨德','额我是','爱仕达']

res = (i for i in t1)

#带有一个元祖推导式得到的生成器
for j in t1:
	p(j)



#带有条件的推导式
t2 = (1,2,3,4,5,6,7,8,9,5,4,3,3,2,543,76,45,23,23,345345,346,345)

res = (i for i in t2 if i%2==0)

for x in res:
	print(x)



# 多个循环的推导式
t3 = ('A','B','C','D')
t4 = ('张三','李四','王五','赵六')


res = ("编号"+a+'的是:'+b for a in t3 for b in t4)
for i in res:
	p(i)


p('======================')

#多个循环并且带条件的推导式
res = ("编号"+a+'的是:'+b for a in t3 for b in t4 if t3.index(a)==t4.index(b))

for x in res:
	p(x)
p(res)














